//package cn.ncbank.obp.bi.user.core;
//
//import org.springframework.beans.BeansException;
//import org.springframework.beans.factory.config.BeanDefinition;
//import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
//import org.springframework.beans.factory.support.BeanDefinitionRegistry;
//import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
//import org.springframework.beans.factory.support.GenericBeanDefinition;
//import org.springframework.cloud.openfeign.FeignClientFactoryBean;
//
//import java.util.Objects;
//
//public class FeignClientDevProfilePostProcessor implements BeanDefinitionRegistryPostProcessor {
//
//    @Override
//    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry beanDefinitionRegistry) throws BeansException {
//        String[] names = beanDefinitionRegistry.getBeanDefinitionNames();
//        for (String name : names) {
//            BeanDefinition beanDefinition = beanDefinitionRegistry.getBeanDefinition(name);
//            if (beanDefinition instanceof GenericBeanDefinition) {
//                GenericBeanDefinition genericBeanDefinition = (GenericBeanDefinition) beanDefinition;
//                Object factoryBeanObject = genericBeanDefinition.getAttribute("feignClientsRegistrarFactoryBean");
//                if (factoryBeanObject != null && factoryBeanObject.getClass() == FeignClientFactoryBean.class) {
//                    FeignClientFactoryBean factoryBean = (FeignClientFactoryBean)factoryBeanObject;
//                    FeignClientFactoryBean devFactoryBean = new FeignClientDevFactoryBean(factoryBean);
//                    genericBeanDefinition.setAttribute("feignClientsRegistrarFactoryBean", devFactoryBean);
//                    genericBeanDefinition.setInstanceSupplier(() -> {
//                        Objects.requireNonNull(genericBeanDefinition.getInstanceSupplier()).get();
//                    });
//                }
//
//            }
//
//        }
//    }
//
//    @Override
//    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
//
//    }
//}
